package com.qf.goeasy;

import io.goeasy.GoEasy;
import io.goeasy.publish.GoEasyError;
import io.goeasy.publish.PublishListener;

import java.util.Scanner;

public class SendMsg {

    public static void main(String[] args) {


        // 1.创建GoEasy对象(连接自己的WebSOcket服务器)
        GoEasy goEasy = new GoEasy("rest-hangzhou.goeasy.io",
                "BC-1f35eadfecb44ba2838fe648c638f71f");

        // 2.发送消息
        goEasy.publish("my_channel", "Hello GoEasy");

        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("输入你要发发送给WebSocket服务器的内容");
            String msg = scanner.next();

            goEasy.publish("my_channel", msg);
        }
    }
}
